var defaults = {
	url: config.path +"/a/ed/edeBasicHospital/app_GetHospitalData",
	provinceId:310000,
	cityID: 310100,
	districtId:""
};

app = new Vue({
	el: '#app',
	data: {
		message: "Vue",
		active : 0,
		hospitals: [],
		cityID: 0,
		districtId: "",
		area: "--"
	},
	methods: {
		onItemClick: function (item) {
			Akuma.setHospital(item.id, item.name);
		},
		toCity: function () {
			Akuma.toCity();
		},
	},
	init: function() {
		var _this = this;
		var data = {};
		if(location.search.indexOf('provinceId') > -1){
			data = {};
		}
		else{
			data = {provinceId: defaults.provinceId, cityID: defaults.cityID, districtId: defaults.districtId};
		}
		$$.getJSON(defaults.url + location.search, data, function(data) {
			if(data.status.index == 10000){
				_this.hospitals = data.results;
			}
		})
	}
});

function show(info){
	//alert(info);
	//console.log(info);
	app.area = info;
	var fuck = ['110000', '120000', '500000', '310000'];
	var url = config.path +"a/sys/area/app_getAreaInfo";
	var data = {};
	$$.getJSON(url, {name: info}, function(data) {
		if(data.status.index == 10000){
			if(fuck.indexOf(data.results.code) > -1){
				data = {
					provinceId: data.results.code,
				}
			}else{
				data = {
					provinceId: data.results.parentId,
					cityID: data.results.code
				}
			}

			$$.getJSON(defaults.url + location.search, data, function(data) {
				if(data.status.index == 10000){
					_this.hospitals = data.results;
				}
			});
		}
	})
    //http://localhost:8080/edoctor/a/sys/area/app_getAreaInfo?name=%E4%B8%8A
}